import { ElMessage, ElMessageBox } from 'element-plus';

const instance = ElMessage;
const boxInstance = ElMessageBox;

const msgInstance = {
  warning: instance.warning,
  success: instance.success,
  info: instance,
  error: instance.error,
};

export const tMessage = {
  warning(arg) {
    msgInstance.warning(arg);
  },
  success(arg) {
    msgInstance.success(arg);
  },
  info(arg) {
    msgInstance.info(arg);
  },
  error(arg) {
    msgInstance.error(arg);
  },
};

export const tAlert = {
  error(arg) {
    boxInstance.alert(arg, '出错了!', {
      type: 'error',
    });
  },
};

export default tMessage;
